<?php
/**
 * 农行返回地址
 * 1=>pay_sn
 * 2=>order_sn
 * 3=>order_type
 * 4=>payment_code
 */
error_reporting(7);
require_once ('./ebusclient/Result.php');
//1、取得MSG参数，并利用此参数值生成验证结果对象
$tResult = new Result();

$tResponse = $tResult->init($_POST['MSG']);
$infos = explode("#",$tResponse->getValue("MerchantRemarks"));

$_POST['pay_sn']       = $infos[1];
$_POST['order_sn']     = $infos[2];
$_POST['order_type']   = $infos[3];
$_POST['payment_code'] = $infos[4];


if($_POST['payment_code']=='mbabcpay' || $_GET['payment_code']=='mbabcpay'){
//    if($_POST['pay_sn']&&$_POST['order_type']){
//        $_GET['act']	      = 'payment';
//        $_GET['op']		      = 'return';
//        $_GET['payment_code'] = 'abcpay';
//
////赋值，方便后面合并使用支付宝验证方法
//        require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/mobile/index.php');
//        exit;
//    }

    $_GET['act']	= 'payment';
    $_GET['op']		= 'notify';
    $_GET['payment_code'] = 'abcpay';

    require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/mobile/index.php');
    exit;
}

if($_POST['payment_code']=='mbabcpay2' || $_GET['payment_code']=='mbabcpay2'){
//    if($_POST['pay_sn']&&$_POST['order_type']){
//        $_GET['act']	      = 'payment';
//        $_GET['op']		      = 'return';
//        $_GET['payment_code'] = 'abcpay2';
//
////赋值，方便后面合并使用支付宝验证方法
//        require_once(dirname(__FILE__).'/../../../index.php');
//        exit;
//    }
    $_GET['act']	= 'payment';
    $_GET['op']		= 'notify';
    $_GET['payment_code'] = 'abcpay2';

    require_once(dirname(__FILE__).'/../../../index.php');
}

if($_POST['payment_code']=='abcpay' || $_GET['payment_code']=='abcpay'){
//    if($_POST['pay_sn']&&$_POST['order_type']){
//        $_GET['act']	      = 'payment';
//        $_GET['op']		      = 'return';
//        $_GET['payment_code'] = 'abcpay';
//
////赋值，方便后面合并使用支付宝验证方法
//        $_GET['out_trade_no'] = $_POST['pay_sn'];
//        $_GET['extra_common_param'] = $_POST['order_type'];
//        $_GET['trade_no'] = '';
//        require_once(dirname(__FILE__).'/../../../index.php');
//        exit;
//    }

    $_GET['act']	= 'payment';
    $_GET['op']		= 'notify';
    $_GET['payment_code'] = 'abcpay';

//赋值，方便后面合并使用支付宝验证方法
    $_POST['out_trade_no'] = $_POST['pay_sn'];
    $_POST['extra_common_param'] = $_POST['order_type'];
    $_POST['trade_no'] = '';
    require_once(dirname(__FILE__).'/../../../index.php');
}

if($_POST['payment_code']=='abcpay2' || $_GET['payment_code']=='abcpay2'){
//    if($_POST['pay_sn']&&$_POST['order_type']){
//        $_GET['act']	      = 'payment';
//        $_GET['op']		      = 'return';
//        $_GET['payment_code'] = 'abcpay2';
//
////赋值，方便后面合并使用支付宝验证方法
//        $_GET['out_trade_no'] = $_POST['pay_sn'];
//        $_GET['extra_common_param'] = $_POST['order_type'];
//        $_GET['trade_no'] = '';
//        require_once(dirname(__FILE__).'/../../../index.php');
//        exit;
//    }

    $_GET['act']	= 'payment';
    $_GET['op']		= 'notify';
    $_GET['payment_code'] = 'abcpay2';

//赋值，方便后面合并使用支付宝验证方法
    $_POST['out_trade_no'] = $_POST['pay_sn'];
    $_POST['extra_common_param'] = $_POST['order_type'];
    $_POST['trade_no'] = '';
    require_once(dirname(__FILE__).'/../../../index.php');
}

?>